import axios from "axios";
import { Message } from "element-ui";

let ajax = axios.create({
    baseURL:"http://1.117.139.29:3000",
    withCredentials:true,
    timeout:5000,
    headers:{
        "Content-Type":'application/x-www-form-urlencoded;charset=UTF-8',
    }
})

//请求拦截
ajax.interceptors.request.use(config=>{
    //自定义拦截规则
    return config;
})
//响应拦截
ajax.interceptors.response.use(response=>{
    //获取接口返回数据
    let res = response.data;
    //自定义响应拦截规则
    return res;
},()=>{
    Message.error('你的网络已经无了！');
})
 export default ajax;